from redis import StrictRedis

class Config:
    DEBUG = None
    # 设置密钥
    SECRET_KEY = 'TDxS5BoJlW6zUFhOZhTHwu3X2OpVFIHIbZdA+JZAgD1Uz92XMZFJNA=='

    # 配置mysql数据库的连接信息，动态追踪修改
    SQLALCHEMY_DATABASE_URI = 'mysql://root:mysql@localhost/info3'
    SQLALCHEMY_TRACK_MODIFICATIONS = False

    # 定义redis的主机和端口
    REDIS_HOST = '127.0.0.1'
    REDIS_PORT = 6379
    # 配置redis连接信息，实现状态保持，存储用户的session信息
    SESSION_TYPE = 'redis'
    SESSION_REDIS = StrictRedis(host=REDIS_HOST,port=REDIS_PORT)
    # 签名
    SESSION_USE_SIGNER = True
    # 配置session的过期时间
    PERMANENT_SESSION_LIFETIME = 86400



# 定义开发模式的配置
class developmentConfig(Config):
    DEBUG = True



# 定义生产模式的配置
class productionConfig(Config):
    DEBUG = False

# 定义字典
config = {
    'development':developmentConfig,
    'production':productionConfig
}